<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>在线课程</title>
    <script>
        ; (function (designWidth, maxWidth) {
            var doc = document,
                win = window,
                docEl = doc.documentElement,
                remStyle = document.createElement("style"),
                tid;

            function refreshRem() {
                var width = docEl.getBoundingClientRect().width;
                maxWidth = maxWidth || 540;
                width > maxWidth && (width = maxWidth);
                var rem = width * 100 / designWidth;
                remStyle.innerHTML = 'html{font-size:' + rem + 'px;}';
            }

            if (docEl.firstElementChild) {
                docEl.firstElementChild.appendChild(remStyle);
            } else {
                var wrap = doc.createElement("div");
                wrap.appendChild(remStyle);
                doc.write(wrap.innerHTML);
                wrap = null;
            }
            //要等 wiewport 设置好后才能执行 refreshRem，不然 refreshRem 会执行2次；
            refreshRem();

            win.addEventListener("resize", function () {
                clearTimeout(tid); //防止执行两次
                tid = setTimeout(refreshRem, 300);
            }, false);

            win.addEventListener("pageshow", function (e) {
                if (e.persisted) { // 浏览器后退的时候重新计算
                    clearTimeout(tid);
                    tid = setTimeout(refreshRem, 300);
                }
            }, false);

            if (doc.readyState === "complete") {
                doc.body.style.fontSize = "14px";
            } else {
                doc.addEventListener("DOMContentLoaded", function (e) {
                    doc.body.style.fontSize = "14px";
                }, false);
            }
        })(828 , 828);
    </script>
    <link rel="stylesheet" href="./css/reset.css">
    <link rel="stylesheet" href="./css/kecheng.css">
    <link rel="stylesheet" href="./css/common.css">
</head>

<body>
    <div class="header flex align-center justify-between">
        <div class="flex align-center">
            <img src="./imgs/logo.png" class="logo" alt="">
            <span>水利造价信息网</span>
        </div>
        <img src="./imgs/fenlei.png" class="fenlei" alt="">
    </div>
    <div class="banner">
        <img src="./imgs/banner.png" class="banner-img" alt="">
    </div>
    <div class="flex flex-wrap item-wrap">
        <div class="item">
            <img src="./imgs/shuili.png" alt="">
            <div>水利水电</div>
        </div>
        <div class="item">
            <img src="./imgs/gongu.png" alt="">
            <div>公路工程</div>
        </div>
        <div class="item">
            <img src="./imgs/jianli.png" alt="">
            <div>监理师考试</div>
        </div>
        <div class="item">
            <img src="./imgs/zaojia.png" alt="">
            <div>一级造价师</div>
        </div>
        <div class="item">
            <img src="./imgs/jianz.png" alt="">
            <div>二级建造师</div>
        </div>
    </div>
    <div class="tabs flex">
        <div class="tab">
            <img src="" alt="">
        </div>
    </div>
    <div style="height: 1rem;">
        <div class="tabbar flex">
            <div class="tab flex1">
                <img src="./imgs/tabs/shouye.png" alt="">
                <div>首页</div>
            </div>
            <div class="tab flex1">
                <img src="./imgs/tabs/huiyuan.png" alt="">
                <div>会员注册</div>
            </div>
            <div class="tab flex1">
                <img src="./imgs/tabs/zixun.png" alt="">
                <div>在线咨询</div>
            </div>
            <div class="tab flex1">
                <img src="./imgs/tabs/gouwuche.png" alt="">
                <div>资料下载</div>
            </div>
            <div class="tab flex1">
                <img src="./imgs/tabs/py.png" alt="">
                <div>在线课堂</div>
            </div>
        </div>
    </div>
    <!-- 弹框 -->
    <div class="layer-wrap kecheng" id="layer">
        <div class="layer">
            <div class="layer-title">水利水电包含如下课程</div>
            <img src="./imgs/guanbi.png" class="close-icon" alt="">
            <div class="choose">请选择：</div>
            <div id="changeBtn">测试按钮，记得删除</div>
            <div id="changeBtn2">点我改变list</div>
            <div class="layer-list">
                <div class="layer-item flex justify-between align-center">
                    <div>
                        <img src="./imgs/kech.png" alt="">
                        <span class="name">《水利水电造价软件应用培训》</span>
                    </div>
                    <div>
                        <span id="name">张三</span>
                        <span>全国</span>
                    </div>
                </div>
                <div class="layer-item flex justify-between align-center">
                    <div>
                        <img src="./imgs/kech.png" alt="">
                        <span class="name">《水利水电造价预算文件编制》</span>
                    </div>
                    <div>
                        <span>张三</span>
                        <span>成都</span>
                    </div>
                </div>
                <div class="layer-item flex justify-between align-center">
                    <div>
                        <img src="./imgs/kech.png" alt="">
                        <span class="name">《套定额租单价》</span>
                    </div>
                    <div>
                        <span>王飞寒</span>
                        <span>河南</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <script>
        $('.item').each(function(i,e) {
            $(this).on('click', function() {
                $('#layer').show()
            })
        })
        $('.close-icon').on('click', function() {
            $('#layer').hide()
        })

        // 测试按钮
        $('#changeBtn').on('click', function(){
            $('#name').html('变成李四')
            setTimeout(() => {
                // 跳转
                window.location.href="https://www.baidu.com"
            }, 2000);
        })
        var list = [{
            name: '111'
        },{
            name: '222'
        },{
            name: '333'
        }]
        var str = ""
        list.forEach(item=>{
            str += `
                <a class="layer-item flex justify-between align-center" href="https://www.baidu.com">
                    <div>
                        <img src="./imgs/kech.png" alt="">
                        <span class="name">《套定额租单价》</span>
                    </div>
                    <div>
                        <span>${item.name}</span>
                        <span>河南</span>
                    </div>
                </a>
            `
        })
        $('.layer-list').html(str)
        function studyAjax(uid) {
            $.ajax({
                type: "GET",
                url: "/video/study-viewtime",
                dataType: 'json',
                data: {uid: uid},
                success: function (res) {
                    var studyes = '';
                    res.study.forEach(function (item) {
                        studyes += `<a class="layer-item flex justify-between align-center" href="https://www.baidu.com">
                            <div class="flex align-center">
                            < img src="/images/centenrimage/yonghu.png" alt="">
                            <span class="name">${item.name}</span>
                            </div>
                            < img src="/images/centenrimage/day.png" class="link" alt="">
                            </a>`;
                    });
                    $('.layer-list').html(studyes);
                }
            });
        }
        
    </script>
</body>

</html>